import store from '@/store'
import storage from 'store'
import Cookie from 'js-cookie'
import { ACCESS_TOKEN, APP_LANGUAGE } from '@/store/mutation-types'

export default function Initializer () {
  store.commit('SET_TOKEN', Cookie.get(ACCESS_TOKEN))
  store.dispatch('setLang', storage.get(APP_LANGUAGE, 'zh-CN'))
  // store.commit('SET_CLIENT_ID', storage.get('client_Id') || window.config?.VUE_APP_CLIENT_ID)
  // store.commit('SET_TENANT_ID', storage.get('tenant_Id') || window.config?.VUE_APP_TENANT_ID)
  // store.commit('SET_APP_ID', storage.get('app_Id') || window.config?.VUE_APP_APP_ID)

  store.commit('SET_CLIENT_ID', process.env.VUE_APP_CLIENT_ID)
  store.commit('SET_TENANT_ID', process.env.VUE_APP_TENANT_ID)
  store.commit('SET_APP_ID', process.env.VUE_APP_APP_ID)
  // last step
}
